package org.lanqiao.tjut.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.lanqiao.tjut.bean.UsersEntity;
import org.lanqiao.tjut.dao.IUserInfoDao;
import org.lanqiao.tjut.mapper.UsersEntityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Repository("userDao")
@Transactional(readOnly = true, propagation = Propagation.NEVER)
public class UserInfoDaoImpl implements IUserInfoDao {
	// 依赖注入，组合mapper对象（面向接口的编程）
	@Autowired
	private UsersEntityMapper userMapper;

	@Override
	//@Transactional(readOnly = true, propagation = Propagation.NEVER)
	public List<UsersEntity> selectAllUsersInfo() {
		// 调用mapper进行处理
		//List<UsersEntity> lstUsers = userMapper.selectUsersInfoList();
		//return lstUsers;
		
		//测试保存
		UsersEntity userE = new UsersEntity();
		userE.setUsername("xiaoming23");		
		userE.setUserage(20);
		userE.setUseraddress("tjut");
		userE.setUserid(14);
		
		userMapper.saveUsersInfo(userE);
		
		return new ArrayList<UsersEntity>();
	}

}
